package cn.com.anypay.manager.dto.request;

import cn.com.anypay.manager.common.validation.PhoneNumberFormat;
import cn.com.anypay.manager.common.validation.ValidationGroups;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.Data;

/**
 * 短信登录相关请求DTO
 */
public class SmsLoginRequest {

    /**
     * 发送验证码请求
     */
    @Data
    public static class SendCodeRequest {

        @NotBlank(message = "手机号不能为空", groups = {ValidationGroups.Login.class})
        @PhoneNumberFormat(message = "手机号格式不正确", groups = {ValidationGroups.Login.class})
        private String phone;
    }

    /**
     * 验证验证码请求
     */
    @Data
    public static class VerifyCodeRequest {

        @NotBlank(message = "手机号不能为空", groups = {ValidationGroups.Login.class})
        @PhoneNumberFormat(message = "手机号格式不正确", groups = {ValidationGroups.Login.class})
        private String phone;

        @NotBlank(message = "验证码不能为空", groups = {ValidationGroups.Login.class})
        @Pattern(regexp = "^\\d{6}$", message = "验证码必须为6位数字", groups = {ValidationGroups.Login.class})
        private String code;
    }
}